require(['config'], function() {
    require(['loadH','loadF','jquery', 'jquery.cookie'], function() {






      $('.loginbt').click( e => {
        
        // 在 li 节点中查找后代节点，构建商品对象
        // 构建当前选购商品的对象
        const _userlist = {
          username: $('.username')[0].value,
          password: $('.password')[0].value,
          online:1
        }
        console.log(_userlist)

        $.cookie.json = true
        const userlist = $.cookie('userlist') || []
        const index = userlist.findIndex(prod => prod.username === _userlist.username&&prod.password === _userlist.password)
        if (index !== -1) { // 存在用户
          userlist[index].online=1
          alert('登录成功')
          $.cookie('userlist', userlist, {expires: 70,path:'/'})
          window.location.href='../index.html'
        }
        else{
          alert('登录信息错误')
        }


      })

      
        
    
    
      








    })
  })